#include "Interpolation.h"
#include <iostream>

using namespace std;

int main()
{
  freopen("./data/E_1.txt","w",stdout);
  vector<double> x{0,6,10,13,17,20,28};
  vector<double> sp1{6.67,17.3,42.7,37.3,30.1,29.3,28.7}, sp2{6.67,16.1,18.9,15.0,10.6,9.44,8.89};
  Newton_formula sample1(x,sp1), sample2(x,sp2);
  for (double i = 0; i <= 28; i += 0.01)
    {
      printf("%lf,",sample1.operate(i));
    }
  puts("");
  for (double i = 0; i <= 28; i += 0.01)
    {
      printf("%lf,",sample2.operate(i));
    }
  puts("");
  fclose(stdout);

  freopen("./data/E_2.txt","w",stdout);
  vector<double> x1{0,6,10,13,17,20,28};
  vector<double> sp3{6.67,17.3,42.7,37.3,30.1,29.3,28.7}, sp4{6.67,16.1,18.9,15.0,10.6,9.44,8.89};
  Newton_formula sample3(x,sp3), sample4(x,sp4);
  for (double i = 0; i <= 50; i += 0.01)
    {
      printf("%lf,",sample3.operate(i));
    }
  puts("");
  for (double i = 0; i <= 50; i += 0.01)
    {
      printf("%lf,",sample4.operate(i));
    }
  puts("");
  fclose(stdout);
  
}
